<template>
  <div class="home">
    <h1>工具箱</h1>
    <div class="tools-grid">
      <router-link
          v-for="tool in tools"
          :key="tool.path"
          :to="tool.path"
          class="tool-card"
      >
        <div class="tool-icon">
          <component :is="tool.icon" />
        </div>
        <h3>{{ tool.name }}</h3>
        <p>{{ tool.description }}</p>
        <p>作者：{{tool.author}}</p>
      </router-link>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import {
  Shuffle,
  Ruler,
  Clock,
  Smile,
  Key,
  Cat,
} from 'lucide-vue-next'

const tools = ref([
  {
    path: '/random-wheel',
    name: '选择困难症转盘',
    description: '今天吃什么/穿什么/干什么？',
    icon: Shuffle,
    author: '刘宜'
  },
  {
    path: '/unit-converter',
    name: '单位换算器',
    description: '温度、长度、时间等单位转换',
    icon: Ruler,
    author: '陈格平'
    },
  {
    path: '/bmi',
    name: 'BMI计算器',
    description: '计算你的身体质量指数',
    icon: Clock,
    author: '蒲奕西'
  },
  {
    path: '/fortune',
    name: '运势推送',
    description: '每日运势+电子木鱼功德+1',
    icon: Smile,
    author: '郑好'
  },
  {
    path: '/morse',
    name: '摩斯密码转换器',
    description: '加密/解密摩斯密码',
    icon: Key,
    author: '梁芯予'
  },
   {
    path: '/virtual-cat',
    name: '虚拟猫咪',
    description: '虚拟猫咪',
    icon: Cat,
    author: '杨雅雯'
  }

])
</script>

<style scoped>
.home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  margin-top: 0;
  text-align: center;
  margin-bottom: 2rem;
  color: #2c3e50;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  color: inherit;
  text-decoration: none;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.tool-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #4a6cf7;
}

h3 {
  margin: 0.5rem 0;
  color: #2c3e50;
}

p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}
</style>